package com.hainatong.jcmvvmbase.mainhome.fragment.warehouse;


import android.os.Bundle;
import android.view.View;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.hainatong.jcmvvmbase.MvvmLazyFragment;
import com.hainatong.jcmvvmbase.R;
import com.hainatong.jcmvvmbase.databinding.FragmentRukuAddListBinding;
import com.hainatong.jcmvvmbase.mainhome.adapter.ItemRukuAdapter;
import com.hainatong.jcmvvmbase.mainhome.entity.EquipmentRecordBean;
import com.hainatong.mvvmbase.base.NoViewModel;

import java.util.ArrayList;
import java.util.List;


public class ReturnAddFragment extends MvvmLazyFragment<FragmentRukuAddListBinding, NoViewModel>
{
    private static String RETURN_ADD_TAG = "ReturnAddFragment";

    private String goodsCode ;

    private ItemRukuAdapter adapter;

    public static ReturnAddFragment newInstance(String scanCode)
    {
        Bundle bundle = new Bundle();
        bundle.putString( RETURN_ADD_TAG , scanCode );
        ReturnAddFragment returnFragment = new ReturnAddFragment();
        returnFragment.setArguments( bundle );
        return returnFragment;
    }

    @Override
    public int getLayoutId()
    {
        return R.layout.fragment_ruku_add_list;
    }

    @Override
    public int getBindingVariable()
    {
        return 0;
    }

    @Override
    protected void initParameters()
    {
        Bundle args = getArguments();
        if(  args != null )
        {
            goodsCode = args.getString(RETURN_ADD_TAG , "");
        }
    }

    @Override
    protected void onRetryBtnClick()
    {}

    @Override
    protected void initView(View view)
    {
        adapter = new ItemRukuAdapter();

        viewDataBinding.recyclerview.setLayoutManager(new LinearLayoutManager(getActivity()));
        viewDataBinding.recyclerview.setHasFixedSize(true);
        viewDataBinding.recyclerview.setAdapter( adapter );

        adapter.setOnItemClickListener((adapter1, view1, position) -> {



        });



    }

    @Override
    protected void lazyLoad()
    {
        List<EquipmentRecordBean> recordBeanList = new ArrayList<>();
        EquipmentRecordBean recordBean = new EquipmentRecordBean();
        recordBean.setEquipName( "救助艇艇机齿轮箱" );
        recordBean.setModelNO("Sq1240");
        recordBean.setSize("黑色 100*100");
        recordBean.setStatus(2);
        recordBeanList.add(recordBean);
        recordBeanList.add(recordBean);
        recordBeanList.add(recordBean);
        recordBeanList.add(recordBean);
        recordBeanList.add(recordBean);
        recordBeanList.add(recordBean);
        recordBeanList.add(recordBean);
        recordBeanList.add(recordBean);
        adapter.setList(recordBeanList);
    }
}
